Here I am doing a small experiment to compare different genetic architectures between snakes and newts. I will use the cost_1on1 simulation and my snake_newt_gv msprime simulation.
Outline
-Pick 4 different mu sigma combinations where musigma^2 is constant (mu=1e-11, sigma=5) to (mu=1e-8, sigma=0.005). -I picked values where musigma was constant mu=1e-11, sigma=5(A), mu=1e-10, sigma=0.5(B), mu=1e-9, sigma=0.05(C), mu=1e-8, sigma=0.005(D). The ABCD represents the group of mu and sigma. When in the newt and snake simulation the groups will be paired to make 16 pairs. -In total that will be 16 msprime simulations and 16 slim simulations -See if there are any obvious winners -make a co-evolutionary heatmap
First run this experiment with these values
Rerunning this experiment with these values
Things with 1e-6 mutation rate go every slow and end up with large file sizes. Might want to think about a different set
I ran msprime simulations and the slim simulations on cluster in GA_lt folder. My goal is to first see if there is an obvious “winner” in the co-evolutionary arms race between these species.
First, I want to look at the mean pheotypes of newts and snakes as the generations increase. Then I want to look at the difference between the mean phenotypes for each of the 16 simulations. I need to make the data frame to compare all 16 simulations. I noticed in the mu=1e-11, sigma=5 simulations that the starting pheotypes of some of the individuals were really high and sometimes the population crashed and died out.
R-code noate: I have code to make my dataframes, it combines many simulations into one graph-able dataframe. Then, I have some functions that can be called to make some figures.
The first step in seeing if there is a winner in the coevolution interaction is to read in the data and look at the results. I make a dataframe named GA_file. It contains all of the data points from my 16 simulations. I normally look at one variable at a time from all of my simulations, but since there are so few I can look at them all at once. There are over 4,000 observations with 28 variables which contains information from both newts and snakes. I focus on the mean phenotype of both the newt and the snake, usually creating a variable that looks at the difference between the mean pheotypes.
Since there are 16 simulations, for convenience I print out the simulation letter with the paramiter I used for the snake and newt mutation rate and mutation effect size
## [1] "Simulation A: Snake mu-rate & effect sd (1.0e-08, 0.005) Newt mu-rate & effect sd (1.0e-08, 0.005)"
## [1] "Simulation B: Snake mu-rate & effect sd (1.0e-08, 0.005) Newt mu-rate & effect sd (1.0e-09, 0.05)"
## [1] "Simulation C: Snake mu-rate & effect sd (1.0e-08, 0.005) Newt mu-rate & effect sd (1.0e-10, 0.5)"
## [1] "Simulation D: Snake mu-rate & effect sd (1.0e-08, 0.005) Newt mu-rate & effect sd (1.0e-11, 5.0)"
## [1] "Simulation E: Snake mu-rate & effect sd (1.0e-09, 0.05) Newt mu-rate & effect sd (1.0e-08, 0.005)"
## [1] "Simulation F: Snake mu-rate & effect sd (1.0e-09, 0.05) Newt mu-rate & effect sd (1.0e-09, 0.05)"
## [1] "Simulation G: Snake mu-rate & effect sd (1.0e-09, 0.05) Newt mu-rate & effect sd (1.0e-10, 0.5)"
## [1] "Simulation H: Snake mu-rate & effect sd (1.0e-09, 0.05) Newt mu-rate & effect sd (1.0e-11, 5.0)"
## [1] "Simulation I: Snake mu-rate & effect sd (1.0e-10, 0.5) Newt mu-rate & effect sd (1.0e-08, 0.005)"
## [1] "Simulation J: Snake mu-rate & effect sd (1.0e-10, 0.5) Newt mu-rate & effect sd (1.0e-09, 0.05)"
## [1] "Simulation K: Snake mu-rate & effect sd (1.0e-10, 0.5) Newt mu-rate & effect sd (1.0e-10, 0.5)"
## [1] "Simulation L: Snake mu-rate & effect sd (1.0e-10, 0.5) Newt mu-rate & effect sd (1.0e-11, 5.0)"
## [1] "Simulation M: Snake mu-rate & effect sd (1.0e-11, 5.0) Newt mu-rate & effect sd (1.0e-08, 0.005)"
## [1] "Simulation N: Snake mu-rate & effect sd (1.0e-11, 5.0) Newt mu-rate & effect sd (1.0e-09, 0.05)"
## [1] "Simulation O: Snake mu-rate & effect sd (1.0e-11, 5.0) Newt mu-rate & effect sd (1.0e-10, 0.5)"
## [1] "Simulation P: Snake mu-rate & effect sd (1.0e-11, 5.0) Newt mu-rate & effect sd (1.0e-11, 5.0)"
The first thing I want to look at are the difference between snake and newt mean phenotypes as the number of generations increases. The first graph presented is the newt mean phenotype for all simulations as the number of generations increases. There are some lines that are squiggly and some lines that are flat. The second plot is the represents the snake mean phenotype as the number of generations increases for all the simulations. The third plot, shows both the newt and snake mean phenotype (red, blue) and the difference between the snake mean phenotype and the newt mean phenotype (snake-newt, black).
Some things that I noticed, are that there are some newt and snake phenotypes that start of really high (I had to cut them so 1st gen is not present). These really high phenotypes dropped after the first generation and were seen in simulations that had a higher mu*si^2 value (last 2 rows/columns). A question that I had after seeing these plots are why are some of them (snake/newt mean phenotypes) flat? Also, the combination of mu times sigma^2 increases the amount of variation. For snakes variation going up as you go down the rows (least A->E->I->M most) and for newts variation increases as you go across the columns (least M->N->O->P most). It might not be strange to see flat phenotype lines in species who have a low variation, but I expected more competition when the GAs were the same. The simulations that seemed to have the most completion were K, L, O, and P. It might be a generation problem, it there where more generations would variation eventually increase? This is one value for the whole simulation, what is occurring at different spatial points throughout the simulation (P.S. I recorded all individuals phenotype, species, fitness, and locations)?
Next, I checked the population size of newts and snakes through out the 5,000 generations. I found that snake population size seems to be higher than newt population size. The way that the colors are stacked indicates that some GA combinations lead to higher population sizes in a species. It is hard to tell which GA leads to a higher population size, but I would hypothesize that the simulations with higher variance (mu*si^2) will increase a species population size. I also looked at the relationship between newt and snake population size and newt/snake phenotype for all of the simulations combined.
When looking at the combined simulation data you can see a relationship between population size and phenotype. As a species population size grows so does its phenotype. For example when the population size of the newts is large then the phenotype of the newts is larger that the phenotype of the newts when the newt population is smaller. However, it is difficult to discern what is going on in each individual simulation and how close the newts and snakes phenotype match.
To get a better idea of what is going on in each simulation I plot newt population size by snake population size and color the points with the difference between snake and newt mean phenotype. The results are really cool to look at!
The relationship between a species population size and the “whining” species can be a times easy to spot (C, G, O, I, J, L, and P), but at other times it can be hard to discern. When snakes are “winning” their population size is greater than the newts. When the newts are “winning” their population size is equal or greater then the snakes. There are other question that I have for this figure, like why are A, F, K, and P not beige? Or why the species with highest variation is not “winning” in the co-evolutionary arms race? I wonder if I would get these sames results if I ran the simulation for longer? - I suspect not because it seems like the colors are getting lighter (as least they look this way in the plot).
To do a reverse check I plot newt mean phenotype by snake mean phenotype and color with the population size. It is not as pretty as the other graph, but it does show that when the phenotype of a species is low it ofter has a smaller population size. I find the smears sort of funny.
I also decided to look at the mean predation of newts by taking newt death (caused by snakes) and dividing by the total newt population size (not sure if this counts the newts that just died). Predation does not look all that different between simulations to me. Should it look different?
Thoughts about predation: If there were lots of newts and snake predation would be higher. If newts had a lower phenotype predation would be higher. If the interaction rate was higher there might be more predation. Right now I do not see any trends. It seems very well mixed.
To examined what would happen if I kept running my simulations for longer I repeated the experiment with 20,000 generations and then again with 100,000 generations. Below are the summary figures for these simulations. The first figure presented shows all 16 simulations the x axis is newt population size and the y axis is snake population size. The color of the points is the difference between snake mean phenotype and newt mean phenotype. If the point is blue snakes have a higher phenotype, if the point is beige snakes and newts have a similar, and if the point is red newts have a higher phenotype.
## [1] "20,000 Gen Simulation A: Snake (1.0e-08, 0.005) Newt (1.0e-08, 0.005)"
## [1] "20,000 Gen Simulation B: Snake (1.0e-08, 0.005) Newt (1.0e-09, 0.05)"
## [1] "20,000 Gen Simulation C: Snake (1.0e-08, 0.005) Newt (1.0e-10, 0.5)"
## [1] "20,000 Gen Simulation D: Snake (1.0e-08, 0.005) Newt (1.0e-11, 5.0)"
## [1] "20,000 Gen Simulation E: Snake (1.0e-09, 0.05) Newt (1.0e-08, 0.005)"
## [1] "20,000 Gen Simulation F: Snake (1.0e-09, 0.05) Newt (1.0e-09, 0.05)"
## [1] "20,000 Gen Simulation G: Snake (1.0e-09, 0.05) Newt (1.0e-10, 0.5)"
## [1] "20,000 Gen Simulation H: Snake (1.0e-09, 0.05) Newt (1.0e-11, 5.0)"
## [1] "20,000 Gen Simulation I: Snake (1.0e-10, 0.5) Newt (1.0e-08, 0.005)"
## [1] "20,000 Gen Simulation J: Snake (1.0e-10, 0.5) Newt (1.0e-09, 0.05)"
## [1] "20,000 Gen Simulation K: Snake (1.0e-10, 0.5) Newt (1.0e-10, 0.5)"
## [1] "20,000 Gen Simulation L: Snake (1.0e-10, 0.5) Newt (1.0e-11, 5.0)"
## [1] "20,000 Gen Simulation M: Snake (1.0e-11, 5.0) Newt (1.0e-08, 0.005)"
## [1] "20,000 Gen Simulation N: Snake (1.0e-11, 5.0) Newt (1.0e-09, 0.05)"
## [1] "20,000 Gen Simulation O: Snake (1.0e-11, 5.0) Newt (1.0e-10, 0.5)"
## [1] "20,000 Gen Simulation P: Snake (1.0e-11, 5.0) Newt (1.0e-11, 5.0)"
The 20,000 generation plot shows a similar pattern to the 5,000 generation plot where there is a higher phenotype when one species has has a mu-rate & effect sd of 1.0e-10 & 0.5. In this simulation set the plots along the diagonal A F K P look more neutral.
Next, I plotted the same figure with the 100,000 generation data. Two of the GAs simulation would not finish (I ran out of memory on A and individuals on P, possibly I will try to rerun them).
## [1] "100,000 Gen Simulation A: Snake (1.0e-08, 0.005) Newt (1.0e-08, 0.05)"
## [1] "100,000 Gen Simulation B: Snake (1.0e-08, 0.005) Newt (1.0e-09, 0.05)"
## [1] "100,000 Gen Simulation C: Snake (1.0e-08, 0.005) Newt (1.0e-10, 0.5)"
## [1] "100,000 Gen Simulation D: Snake (1.0e-08, 0.005) Newt (1.0e-11, 5.0)"
## [1] "100,000 Gen Simulation E: Snake (1.0e-09, 0.05) Newt (1.0e-08, 0.005)"
## [1] "100,000 Gen Simulation F: Snake (1.0e-09, 0.05) Newt (1.0e-09, 0.05)"
## [1] "100,000 Gen Simulation G: Snake (1.0e-09, 0.05) Newt (1.0e-10, 0.5)"
## [1] "100,000 Gen Simulation H: Snake (1.0e-09, 0.05) Newt (1.0e-11, 5.0)"
## [1] "100,000 Gen Simulation I: Snake (1.0e-10, 0.5) Newt (1.0e-08, 0.005)"
## [1] "100,000 Gen Simulation J: Snake (1.0e-10, 0.5) Newt (1.0e-09, 0.05)"
## [1] "100,000 Gen Simulation K: Snake (1.0e-10, 0.5) Newt (1.0e-10, 0.5)"
## [1] "100,000 Gen Simulation L: Snake (1.0e-10, 0.5) Newt (1.0e-11, 5.0)"
## [1] "100,000 Gen Simulation M: Snake (1.0e-11, 5.0) Newt (1.0e-08, 0.005)"
## [1] "100,000 Gen Simulation N: Snake (1.0e-11, 5.0) Newt (1.0e-09, 0.05)"
## [1] "100,000 Gen Simulation O: Snake (1.0e-11, 5.0) Newt (1.0e-10, 0.5)"
## [1] "100,000 Gen Simulation P: Snake (1.0e-11, 5.0) Newt (1.0e-11, 5.0)"
These results show a very different pattern in the newt snake phenotype. A higher phenotype occurs when the other species has a lower variation (mu*si^2). I wonder if this is due to drift (the flat lines). I also find it weird how neutral the some of the simulations in the third column and row look. So I decided to plot the mean newt phenotype, snake mean phenotype and the difference betwwen snake-newt phenotype as the number of gernerations increased.
This is kind of a cool result! It seems like when mu*si^2 is low that species has a disadvantage and cannot coevolve with the other species. It also seems that when the mu-rate & effect sd are 1.0e-10 & 0.5 there might be and advantage for that species for some time, but the other species can catch up.
For this section summarized the data to presented in one plot. I summarize the last half of the data for 5,000 generations the last 1,500 generations for 20,000 generations and the last 10,000 generations for the 100,000 simulation. By summarizing the data I can try to compare the GA of the snakes tot the GA of the newts through information of their population sizes and phenotypes. I summarize by taking the mean value of a specific parameter.
In each of these plots color will represent the GA of the snake and shape will represent the GA of the newt. The colors and shapes are labeled with the mutation rate and mutation effect size sd seperated by a subscript.
The first figure in this section plots newts population size by snakes population size. As we saw previously, a larger population size indicates that a species has a higher phenotype or might be “winning” in a coevolutionary arms race. In this figure I can see four chunks, a top left a middle left, middle right, and bottom right each containing either 3 or 5 points. The top left chunk I think snakes are successfully winning, the have a much larger population size than newts and their phenotype was higher (seen in 16 sim plot). The middle left chunk snakes could be winning, the snake population size was larger, but the was not a big difference between newts and snake phenotypes. In the middle right chunk, the snake population size was a bit larger than newt population size, but newts often had a higher mean phenotype so I think the newts are winning. In the bottom right chunk newts are winning, they have both a larger population size and a higher phenotype. For the different GAs I noticed that a species is more likely to win if; first they have a GA with 1e-10_0.5, second they do not have a GA of 1e-11_5, third when snakes and newts had the same GA the pehnotypes were similar or newts were winning. The second and third plots show either newt or snake population size by the difference between snake and newt mean phenotype. They show/confirm what I saw in the first plot upper chunk snakes are winning, lower chunk newts are winning, center chunks harder to tell. I dont see any direct pattern of color and shape, there might be an interaction pattern, but I havent been able to spot it.
I also summarized and examined the data for the simulations that I ran longer than the 5,000 generations. The results some-what agree and disagree with the above figures. First, the 20,000 generation figure looks similar to the 5,000 generation. There are sill 4 groups altho the groups seem to be spreading out more. There seems to be some clear winners, but some of the clear winners are different than what I saw in the 5,000gen experiment. Some of the shapes are clustering together like the plus and squares. There might be a color pattern red, green , purple, blue, but I am not sure.
In the 100,000 generation experiment the results look very different than the 5,000 or 20,000 generations. There are three distinct groups. One where the snakes are winning and one wher the newts are winning. Any species that did not have the 1e-8_0.005 was winning. Newts tended to lose more than the snakes. There are several points that are sticking arounfd the center. I wonder if I can turn this into an animation?
##Heatmap
The last result section of this markdown will hold the results of my heat maps. My experiment had 16 simulations with 4 different types of GA for both the newts and snakes. My goal was to see if I could easily determine a winner from these results. All of the heat maps will have the GA of the newt along the x-axis and the GA of the snake along the y-axis. The intersection of the axis (a box) is one simulation that I ran. Each box will have a color that is either the population size of the snake or the diffence between snake mean phenotype and newt mean phenotype.
For the 5,000 generation simulation I have created two heat maps. The first heatmap shows how the GA of newts and snakes effected the size of the snake population. As we saw in earier results the simulations with the smallest snake population size ocurred when the newts had a GA of 1e-10 and 0.5. The simulations where the snake had the largest population size ocurred when the snakes had a GA of 1e-10 and 0.5. Now in the second figure we can really look at the difference between snake and newt phenotype. I see similar results, but I also noticed that a species phenotype was higher when the other speces had a GA of 1e-11 and 5 (except when they meet). The boxes along the diagonol seem close to neutral or newts had a higher phenotype. Now I will look at the results from the 20,000 generation experiment.
In the 20,000 generation experiment the results look similar to the results in the 5,000 generation experiments. Here snakes and newts with the GA of 1e-10 and 0.05 have an advantage both in population size and phenotype. I see less of a pattern when the GA is 1e-11 and 5. The diganal seems to be more neutral in this result. I might also see a losing pattern stating to form the the GA is 1e-1 and 0.005 (light, dark, other color). There is a bit of an odd symmetry here. Lastly, I will look at the results from the 100,000 generation simulations. Again the two grey boxes are where my simulation failed to run (no memory and individuals died out)
Again, these results are very different when compared to the 5,000 and 20,000 generation simulations. The only pattern that I see is that when either the newt or snake has a GA of 1e-8 and 0.005 the other species has a higher phenotype and population size. Most of the other simulations ended up being close to neutral except when the snake GA is 1e-10_0.5 and the newt GA is 1e-11_5. I no longer see an advantage when the GA is 1e-10_0.5. I wonder why this occurred. Is this what steady state looks like? Is coevolution still occurring? Why did that one box get really blue? Is the species who is winning because the other species 1e-8_0.005 because that GA is not realistic? Are the effects of the mutations too low? I wonder how this boxplot would look though a series of time steps.
It was really cool to see how different GA effect effects the phenotype and population sizes of newts and snakes. It is really confusing trying to compare GA that have different orders of magnitude. I wonder if mutation rate or effect size sd drives coevolution or a combination of the two of them. If I repeated the experiment would the results be the same?
Something I would like to try next is to see these results ib a simulation with no interaction.